import Vue from 'vue'
import VueX from 'vuex'

Vue.use(VueX)

export default new VueX.Store({
	state: {
		singerinfo: {},
		songinfo: {},
		songsrc: '',
		currentTime: '',
		stopOrStart: true
	},
	mutations: {
		getSingerInfo(state, data) {
			state.singerinfo = data;
		},
		getSongInfo(state, data) {
			state.songinfo = data
		},
		getSongSrc(state, data) {
			state.songsrc = data
		},
		getCurrentTime(state, data) {
			state.currentTime = data
		},
		getStopOrStart(state, data) {
			state.stopOrStart = data
		}
	},
	actions: {
		getSingerInfo(context, data) {
			context.commit('getSingerInfo', data)
		},
		getSongInfo(context, data) {
			context.commit('getSongInfo', data)
		},
		getSongSrc(context, data) {
			context.commit('getSongSrc', data)
		},
		getCurrentTime(context, data) {
			context.commit('getCurrentTime', data)
		},
		getStopOrStart(context, data) {
			context.commit('getStopOrStart', data)
		}
	},
	getters: {
		getSingerInfo(state) {
			return state.singerinfo
		},
		getSongInfo(state) {
			return state.songinfo
		},
		getSongSrc(state) {
			return state.songsrc
		},
		getCurrentTime(state) {
			return state.currentTime
		},
		getStopOrStart(state) {
			return state.stopOrStart
		}
	}
})